<?php get_header();
$obj_category = get_queried_object();
$cat_id = $obj_category->term_id;
$cat_title = $obj_category->name;
$cat_description = category_description($cat_id);
$cat_permalink = get_term_link($obj_category);
?>

<?php // var_dump($cat_permalink) ?>

    <div>
        <?php
        if (function_exists('yoast_breadcrumb')) {
            yoast_breadcrumb('<div class="breadcrumb">', '</div>');
        }
        ?>
    </div>
    <h1><?php echo $cat_title ?></h1>
    <h2><?php echo $cat_description ?></h2>

    <ul>
        <?php
        while (have_posts()): the_post();
            $post_id = get_the_ID();
            $title = get_the_title();

            $post->filter = 'sample';
            $permalink = get_permalink();
            $excerpt = Azio_Posts::get_excerpt($post_id);

            $thumbnail_id = get_post_thumbnail_id($post_id);
            $image = wp_get_attachment_image_src($thumbnail_id, 'thumbnail', true);
            $image_thumbnail = $image[0];
            ?>
            <li>
                <h3><a href="<?php echo $permalink ?>" title="<?php echo esc_attr($title) ?>"><?php echo $title ?></a>
                </h3>
                <img src="<?php echo $image_thumbnail ?>" alt="<?php echo esc_attr($title) ?>"/>
                <p><?php echo $excerpt ?></p>
            </li>

        <?php endwhile ?>
    </ul>

    <div>
        <?php if (function_exists('wp_pagenavi')) wp_pagenavi(); ?>
    </div>
<?php get_footer() ?>